﻿namespace CSharpPro2._0925;

public class Demo
{
    //作业1
    public class TestPrint1
    {
        public void Test1()
        {
            Console.WriteLine("请输入一个年份:\n ");
            int year = Convert.ToInt32(Console.ReadLine());

            bool flag = (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
            if (flag)
            {
                Console.WriteLine($"{year}年是闰年");
            }
            else
            {
                Console.WriteLine($"{year}年不是闰年");
            }
        }
    }
    //作业2
    public class TestPrint2
    {
        public void Test2()
        {
            double price = 8800;
            Console.WriteLine("月份(1-12): ");
            int month = Convert.ToInt32(Console.ReadLine());
            
            Console.Write("交通(1=航班,2=动车): ");
            int transport = Convert.ToInt32(Console.ReadLine());

            double discount;
            if (month >= 5 && month <= 10)
            {
                if (transport == 1)
                {
                    discount = 0.9;
                }
                else
                {
                    discount = 0.75;
                }
            }
            else
                {
                    if (transport == 1)
                    {
                        discount = 0.6;
                    }
                    else
                    {
                        discount = 0.3;
                    }
                }
            double finalPrice = price * discount;
            Console.WriteLine($"旅游项目最终价格: {finalPrice:C}");
            }
        }
    }
    